IF(PACKAGE_ON_INSTALL)
IF(WIN32)
  SET(APPS "\${CMAKE_INSTALL_PREFIX}/bin/ASAP.exe")
  SET(APPS_DEBUG "\${CMAKE_INSTALL_PREFIX}/bin/ASAP_d.exe")
  SET(LIBS "\${CMAKE_INSTALL_PREFIX}/bin/libEGL.dll" "\${CMAKE_INSTALL_PREFIX}/bin/Qt5OpenGL.dll" "\${CMAKE_INSTALL_PREFIX}/bin/plugins/filters/NucleiDetectionFilterPlugin.dll" "\${CMAKE_INSTALL_PREFIX}/bin/formats/openslidefileformat.dll")
  SET(LIBS_DEBUG "\${CMAKE_INSTALL_PREFIX}/bin/libEGLd.dll" "\${CMAKE_INSTALL_PREFIX}/bin/Qt5OpenGLd.dll" "\${CMAKE_INSTALL_PREFIX}/bin/plugins/filters/NucleiDetectionFilterPlugin_d.dll" "\${CMAKE_INSTALL_PREFIX}/bin/formats/openslidefileformat_d.dll")
  if(BUILD_IMAGEPROCESSING)
    get_target_property(opencv_dll_location opencv_world IMPORTED_LOCATION_RELEASE)
    get_filename_component(opencv_dll_directory ${opencv_dll_location} DIRECTORY)
  endif(BUILD_IMAGEPROCESSING)
  SET(DIRS ${Qt5_DIR}/../../../bin ${opencv_dll_directory} ${OPENSLIDE_INCLUDE_DIR}/../../bin ${PugiXML_INCLUDE_DIR}/../bin ${UNITTEST_INCLUDE_DIR}/../bin ${Boost_LIBRARY_DIRS})
  INCLUDE(InstallRequiredSystemLibraries)
  INSTALL(FILES ${Qt5_DIR}/../../../plugins/platforms/qwindows.dll DESTINATION bin/platforms CONFIGURATIONS Release)
  INSTALL(FILES ${Qt5_DIR}/../../../plugins/platforms/qwindowsd.dll DESTINATION bin/platforms CONFIGURATIONS Debug)
  IF(EXISTS ${Qt5_DIR}/../../../bin/libEGL.dll)
      INSTALL(FILES ${Qt5_DIR}/../../../bin/libEGL.dll DESTINATION bin CONFIGURATIONS Release)
  ENDIF(EXISTS ${Qt5_DIR}/../../../bin/libEGL.dll)
  IF(EXISTS ${Qt5_DIR}/../../../bin/libEGLd.dll)
      INSTALL(FILES ${Qt5_DIR}/../../../bin/libEGLd.dll DESTINATION bin CONFIGURATIONS Debug)
  ENDIF(EXISTS ${Qt5_DIR}/../../../bin/libEGLd.dll)  
  FILE(GLOB D3D_LIB ${Qt5_DIR}/../../../bin/d3dcompiler_*.dll)
  INSTALL(FILES ${D3D_LIB} DESTINATION bin)
  INSTALL(FILES ${Qt5_DIR}/../../../bin/Qt5OpenGL.dll DESTINATION bin CONFIGURATIONS Release)
  INSTALL(FILES ${Qt5_DIR}/../../../bin/Qt5OpenGLd.dll DESTINATION bin CONFIGURATIONS Debug)
  INSTALL(CODE "
   include(BundleUtilities)
   if(\"\${CMAKE_INSTALL_CONFIG_NAME}\" STREQUAL \"Debug\")
   fixup_bundle(\"${APPS_DEBUG}\"   \"${LIBS_DEBUG}\"   \"${DIRS}\")
   else()
   fixup_bundle(\"${APPS}\"   \"${LIBS}\"   \"${DIRS}\")
   endif()
   ")  
ENDIF(WIN32)
ENDIF(PACKAGE_ON_INSTALL)
